"""
求阶乘序列前N项和

本题要求编写程序，计算序列 1!+2!+3!+⋯ 的前N项之和。
"""


def get_fact_table(n):
    table = []
    result = 1
    for item in range(1, n+1):
        result *= item
        table.append(result)
    return table


def resolution1():
    n = int(input())
    table = get_fact_table(n)

    result = 0
    for item in range(0, n):
        result += table[item]

    print(result)


if __name__ == '__main__':
    resolution1()